﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using BCDto.OA.TeamWorks.TaskResourceRecord;
using BCService.OA.TeamWorks.TaskResourceRecord;
using Microsoft.AspNetCore.Mvc;

namespace BlackCoffeeRESTful.Controllers.Management.OA.Workflow.TaskRecord
{
    /// <summary>
    /// OA工作流任务资源文件记录
    /// </summary>
    [ApiExplorerSettings(GroupName = "OAAdmin")]
    [Route("api/v1/sim/[controller]")]
    public class TaskResourceRecordController : ManagementBaseController
    {
        private readonly ITaskResourceRecordService taskResourceRecordService;

        public TaskResourceRecordController(ITaskResourceRecordService taskResourceRecordService)
        {
            this.taskResourceRecordService = taskResourceRecordService;
        }

        #region 获取工作流资源文件列表
        /// <summary>
        /// 获取工作流资源文件列表
        /// </summary>
        /// <param name="workflowActivityInstanceId">工作流活动实例Id</param>
        /// <response code="200">获取工作流资源文件列表。</response>
        /// <returns></returns>
        [HttpGet("{workflow_activity_instance_id}")]
        [ProducesResponseType(typeof(IEnumerable<TaskResourceRecordDto>), 200)]
        public IActionResult Get([FromRoute(Name = "workflow_activity_instance_id")]int workflowActivityInstanceId)
        {
            return this.Ok(this.taskResourceRecordService.GetList(workflowActivityInstanceId));
        }
        #endregion
    }
}
